﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using System.Security.Cryptography;
using System.IdentityModel.Tokens;

namespace Client
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
			try
			{
				panel_Test1.BackColor = Control.DefaultBackColor;
				textBox_Test1.Text = "";
				Refresh();
				RelyingParty.RPServiceTest1Client RP = new RelyingParty.RPServiceTest1Client();
	            textBox_Test1.Text = RP.Test1();
				panel_Test1.BackColor = Color.Lime;
			}
			catch (Exception Ex)
			{
				panel_Test1.BackColor = Color.Red;
				MessageBox.Show(Ex.Message);
			}
        }

		private void button_Test2_Click(object sender, EventArgs e)
        {
			try
			{
				panel_Test2.BackColor = Control.DefaultBackColor;
				textBox_Test2.Text = "";
				Refresh();
				RelyingParty.RPServiceTest2Client RP = new RelyingParty.RPServiceTest2Client();
				RP.ClientCredentials.UserName.UserName = textBox_UN.Text;
				RP.ClientCredentials.UserName.Password = textBox_PW.Text;
				textBox_Test2.Text = RP.Test2();
				panel_Test2.BackColor = Color.Lime;
			}
			catch (Exception Ex)
			{
				panel_Test2.BackColor = Color.Red;
				MessageBox.Show(Ex.Message);
			}
        }

		private void button_Test3_Click(object sender, EventArgs e)
		{
			try
			{
				panel_Test3.BackColor = Control.DefaultBackColor;
				textBox_Test3.Text = "";
				Refresh();
				RelyingParty.RPServiceTest3Client RP = new RelyingParty.RPServiceTest3Client();
				RP.ClientCredentials.UserName.UserName = textBox_UN.Text;
				RP.ClientCredentials.UserName.Password = textBox_PW.Text;
				textBox_Test3.Text = RP.Test3();
				panel_Test3.BackColor = Color.Lime;
			}
			catch (Exception Ex)
			{
				panel_Test3.BackColor = Color.Red;
				MessageBox.Show(Ex.Message);
			}
		}

		private void button_Test4_Click(object sender, EventArgs e)
		{
			try
			{
				panel_Test4.BackColor = Control.DefaultBackColor;
				textBox_Test4.Text = "";
				Refresh();
				RelyingParty.RPServiceTest4Client RP = new RelyingParty.RPServiceTest4Client();
				RP.ClientCredentials.UserName.UserName = textBox_UN2.Text;
				RP.ClientCredentials.UserName.Password = textBox_PW2.Text;
				textBox_Test4.Text = RP.Test4();
				panel_Test4.BackColor = Color.Lime;
			}
			catch (Exception Ex)
			{
				panel_Test4.BackColor = Color.Red;
				MessageBox.Show(Ex.Message);
			}
		}

		private void button_TestAll_Click(object sender, EventArgs e)
		{
			button_Test1.PerformClick();
			button_Test2.PerformClick();
			button_Test3.PerformClick();
			button_Test4.PerformClick();
		}
    }
}
